package fr.ants.view;

/**
 * @author Guillaume Ruscassie
 * 
 */
public enum Items {

	/**
	 * button load.
	 */
	LOAD("/icons/folder_open.png", "Charger une carte", "load_map"),
	/**
	 * button save.
	 */
	SAVE_STATS("/icons/save.png", "Sauvegarder les statistiques", "save_stats"),
	/**
	 * button stop.
	 */
	STOP("/icons/bt_stop.png", "Arréter la simulation", "stop"),
	/**
	 * button play.
	 */
	PLAY("/icons/bt_play.png", "Démarrer la simulation", "play"),
	/**
	 * button pause.
	 */
	PAUSE("/icons/bt_pause.png", "Mettre en pause la simulation", "pause"),
	/**
	 * button new nest.
	 */
	NEW_NEST("/icons/add.png", "Nouvelle fourmilière", "new_nest"),
	/**
	 * button add a resource.
	 */
	RESOURCE("/draw/poke/resource_full.png", "Ressource", "ressource"),
	/**
	 * button selection.
	 */
	SELECTION("/icons/select.png", "Selection", "selection"),
	/**
	 * button accelerate.
	 */
	ACCELERATE("/icons/bt_ff.png", "Accélérer", "accelerate"),
	/**
	 * button slow.
	 */
	SLOW("/icons/bt_rev.png", "Ralentir", "slow"),
	/**
	 * button exit.
	 */
	EXIT("", "Quitter", "exit"),
	/**
	 * put the obstacle.
	 */	
	OBSTACLE("/draw/poke/node_05.png", "Place un obstacle ici", "obstacle"),
	/**
	 * put the obstacle here.
	 */	
	OBSTACLE_HERE("/draw/poke/node_05.png", "Placer un obstacle ici", "obstacle_here"),
	/**
	 * put the resource.
	 */
	RESOURCE_HERE("", "Placer une ressource ici", "resource_here"),
	/**
	 * button file.
	 */
	FILE("", "Fichier", "file"),
	/**
	 * recent maps.
	 */
	RECENT_MAP("", "Cartes récentes", "recent_map"),
	/**
	 * field open a map.
	 */
	//OPEN("", "Ouvrir une carte", "open_map"),
	/**
	 * Delete a element.
	 */
	DELETE("","Supprimer","delete");

	/**
	 * label for a field.
	 */
	private final String label;

	/**
	 * path of the icon.
	 */
	private final String icon;

	/**
	 * name of the action.
	 */
	private final String actionName;

	/**
	 * Constructor of the {@link FieldsTree}.
	 * 
	 * @param icon
	 *            path of the icon
	 * @param label
	 *            label of the icon
	 * @param value
	 *            value of the field
	 */
	private Items(final String icon, final String label, final String actionName) {
		this.icon = icon;
		this.label = label;
		this.actionName = actionName;
	}

	/**
	 * @return label
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * @return path oh the icon
	 */
	public String getIcon() {
		return icon;
	}

	/**
	 * 
	 * @return the name of the action
	 */
	public String getActionCommand() {
		return actionName;
	}

	/**
	 * Search a icon by its name.
	 * 
	 * @param actionCommand
	 *            of the icon
	 * @return a {@link Items}
	 */
	public static Items getFromActionCommand(String actionCommand) {
		Items iconeFound = null;
		for (Items ico : Items.values()) {
			if (ico.getActionCommand().equals(actionCommand)) {
				iconeFound = ico;
			}
		}
		return iconeFound;
	}

}
